package com.bc.bcmodel.req;

import com.bc.bcmodel.Entity;
import com.bc.bcmodel.domain.T_Mnguser_infoModel;
import com.bc.bcmodel.domain.T_User_buyer_infoModel;
import com.bc.bcmodel.domain.T_User_seller_infoModel;
import com.bc.commoncore.util.DataUtils;
import com.bc.commoncore.util.DateUtil;
import com.bc.commoncore.util.Digest;
import com.bc.commoncore.util.StringUtils;
import com.bc.commonentity.enums.HttpReturnRnums;

/**
 * Created by lianzerong on 2018/8/22.
 */
public class UserSignUpReq extends Entity {

    private static final long serialVersionUID = 325290847599542858L;

    private String email;//注册邮箱
    private String passWd;//注册密码
    private String vcode;//图片验证码
    private String country;//国家
    private String inviteCode;//邀请码

    public String getInviteCode() {
        return inviteCode;
    }

    public void setInviteCode(String inviteCode) {
        this.inviteCode = inviteCode;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getPassWd() {
        return passWd;
    }

    public void setPassWd(String passWd) {
        this.passWd = passWd;
    }

    public String getVcode() {
        return vcode;
    }

    public void setVcode(String vcode) {
        this.vcode = vcode;
    }

    public HttpReturnRnums paramsCheck() {
        if (!DataUtils.isEmail(getEmail())) {
            return HttpReturnRnums.ParaError;
        }
        if (StringUtils.isEmpty(getPassWd())) {
            return HttpReturnRnums.PASSWD_IS_EMPTY;
        }
//        if (StringUtils.isEmpty(getVcode())) {
//            return HttpReturnRnums.VCODE_IS_EMPTY;
//        }
        return HttpReturnRnums.Success;
    }

    public T_User_seller_infoModel convertor(String userId) {
        T_User_seller_infoModel model = new T_User_seller_infoModel();
        model.setEmail(getEmail());
        model.setMemo(org.apache.commons.lang.StringUtils.EMPTY);
        model.setCreate_time(DateUtil.getToday());
        model.setHead_figure(org.apache.commons.lang.StringUtils.EMPTY);
        model.setModify_time(DateUtil.getToday());
        model.setName(StringUtils.EMPTY);
        model.setNick_name(StringUtils.EMPTY);
        model.setPassword(Digest.signMD5(getPassWd(), Digest.ENCODE));
        model.setStatus("0");
        model.setUser_id(userId);
        model.setRequest_from("websit");
        model.setInvite_code(getInviteCode());
        model.setIntegral(0);
        return model;
    }



}
